<!--- if passed, with filter else none --->
<CFIF qryCRGUSERFILTERCONDITION.recordCount GT 0>
	<!---<CFSET sBuffFilter = "1=0">--->
	<CFSET sBuffFilter = "">
	<CFSET sBuffFilterAll = "">
	<CFIF filterType EQ "USERDEFINED">
		<!---{{{ USERDEFINED--->
		<CFOUTPUT QUERY="qryCRGUSERFILTERCONDITION">
			<CFSET sBuffFilter = sBuffFilter & "#GROUPSTART# #SOURCEFIELD# #OPERATOR# '#VALUEORALIAS#' #GROUPEND# #JOININGOPERATOR# ">
			<CFSET sJoiningOperator = JOININGOPERATOR>
		</CFOUTPUT>

		<CFIF sBuffFilter NEQ "">
			<CFSET sBuffFilter = "(" & left(sBuffFilter, len(sBuffFilter) - (len(sJoiningOperator) + 1)) & ")">
		</CFIF>
		<!---}}}--->
	<CFELSE>
		<!---{{{ GROUP--->
		<CFIF qryCRGUSERFILTERCONDITION.GROUPFILTERTYPE EQ "referenceDirectField">
			<CFQUERY NAME = "getUserFilterCode" DATASOURCE="#client.company_dsn#">
				SELECT #qryCRGUSERFILTERCONDITION.USERFILTERFIELD# theUserCode FROM CMFPA
				WHERE #sqlUPPERCASE#(PERSONNELIDNO) = #sqlUPPERCASE#('#client.chapa#')
			</CFQUERY>
			<CFIF getUserFilterCode.recordCount GT 0>
				<CFSET sBuffFilter = "(#qryCRGUSERFILTERCONDITION.TABLEFILTERFIELD# = '#getUserFilterCode.theUserCode#')">
			</CFIF>
		<CFELSE>
			<CFQUERY NAME = "getUserFilterCode" DATASOURCE="#client.company_dsn#">
				SELECT #qryCRGUSERFILTERCONDITION.USERFILTERFIELD# AS theUserCode
				FROM CMFPA
				WHERE   PERSONNELIDNO = '#client.chapa#'
			</CFQUERY>
			<CFSET qryCRGUSERFILTERCONDITION.TABLEFILTERFIELD=qryCRGUSERFILTERCONDITION.USERFILTERFIELD>
			<CFIF getUserFilterCode.recordCount GT 0>
				<CFSET sBuffFilter = "(#qryCRGUSERFILTERCONDITION.TABLEFILTERFIELD# IN (#quotedValueList(getUserFilterCode.theUserCode)#))">
			</CFIF>
		</CFIF>
		<!---}}}--->
	</CFIF>
	<CFIF sBuffFilterAll NEQ "">
		<CFSET sBuffFilterAll = sBuffFilterAll & " AND " & sBuffFilter>
	<CFELSE>
		<CFSET sBuffFilterAll = sBuffFilter>
	</CFIF>
</CFIF>


